package cn.wolfcode.wolf2w.controller;

import cn.wolfcode.wolf2w.annotation.UserParam;
import cn.wolfcode.wolf2w.domain.*;
import cn.wolfcode.wolf2w.query.TravelQuery;
import cn.wolfcode.wolf2w.service.*;
import cn.wolfcode.wolf2w.util.JsonResult;
import cn.wolfcode.wolf2w.util.UMEditorUploader;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;


@RestController
@RequestMapping("spots")
public class SpotController {

    @Autowired
    private ISpotService spotService;
    @Autowired
    private ISpotDetailService spotDetailService;


    //保存方法
    @GetMapping("/list")       //参数上加注解,说明为解析器生成
    public Object list() {
        List<Spot> spots = spotService.selectAll();
        return JsonResult.success(spots);
    }

    //查询详情方法
    //保存方法
    @GetMapping("/detail")
    public Object detail(String id) {
        System.out.println(id);
        //查询出某个id的详情数据
        SpotDetail spotDetail = spotDetailService.get(id);
        //返回
        return JsonResult.success(spotDetail);
    }


}
